public class Solution {
    public int findNthDigit(int n) {
        if (n < 10) return n;
        n -= 10;
        int temp = 2;
        while (n >= temp * 9 * Math.pow(10, temp - 1)) {
            n -= temp * 9 * Math.pow(10, temp - 1);
            temp += 1;
        }
        int num = (int) (Math.pow(10, temp - 1)) + n / temp;
        return String.valueOf(num).charAt(n % temp) - '0';
    }

    public static void main(String[] args) {
        System.out.println(new Solution().findNthDigit(11));
    }
}
